:root {
  color-scheme: light;
  --ink: #241f1a;
  --muted: #756d63;
  --line: #d8d0c5;
  --surface: #f7f3ee;
  --panel: #ffffff;
  --accent: #8e6d3d;
  --accent-dark: #5e4727;
  --pending: #8a4d28;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select {
  font: inherit;
}

.viewer-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}

.topbar,
.controls,
.details {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding-inline: clamp(16px, 3vw, 36px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 22px;
  padding-bottom: 16px;
}

.eyebrow,
.detail-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 2.3vw, 2.35rem);
  line-height: 1.1;
}

.status-pill {
  min-width: 116px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--panel);
  color: var(--accent-dark);
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
}

.controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: end;
  gap: 14px;
  padding-top: 8px;
  padding-bottom: 18px;
}

.control-group {
  display: grid;
  gap: 6px;
}

label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 38px 0 12px;
  background: var(--panel);
  color: var(--ink);
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: #ebe4db;
}

.segment {
  min-width: 112px;
  border: 0;
  border-radius: 6px;
  padding: 7px 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.segment.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(36, 31, 26, 0.12);
}

.image-stage {
  position: relative;
  width: min(1440px, calc(100% - 32px));
  min-height: 420px;
  margin: 0 auto;
  border: 1px solid var(--line);
  background: #dfd7cc;
  display: grid;
  place-items: center;
  overflow: hidden;
}

#renderImage {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 236px);
  min-height: 420px;
  object-fit: contain;
  display: block;
}

.pending-panel {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 24px;
  background: #efe9e1;
  text-align: center;
}

.pending-panel h2 {
  margin-bottom: 0;
  color: var(--pending);
  font-size: 1.4rem;
}

.pending-panel p {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
}

.hidden {
  display: none;
}

.details {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-top: 16px;
  padding-bottom: 24px;
}

.details h2 {
  margin-bottom: 0;
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
}

#selectionMeta {
  align-self: end;
  margin-bottom: 2px;
  color: var(--muted);
  text-align: right;
}

@media (max-width: 820px) {
  .topbar,
  .details {
    display: grid;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .segmented {
    grid-auto-flow: row;
    grid-template-columns: 1fr 1fr;
  }

  .segment {
    min-width: 0;
  }

  .image-stage {
    width: calc(100% - 24px);
    min-height: 300px;
  }

  #renderImage {
    min-height: 300px;
    max-height: none;
  }

  #selectionMeta {
    text-align: left;
  }
}
